{% set page_name = "coin_show" %}
{% import "components/nothing.html" as nothing with context %}
{% import "components/paginator.html" as paginator with context %}
{% extends "layout/basic.html" %}
{% block content %}
<div class="row">
  <div class="medium-12 columns">
    <div class="section">
      <div class="section__header">
        <h1 class="section__title">所有有过硬币的学员</h1>
        <div class="section__tools">
          <a href="/coin/inc">
            <button class="primary rounded button">[SU]发放硬币</button>
          </a>
          <a href="/coin/bill/0">
            <button class="primary rounded button">[SU]查看所有人的硬币发放记录</button>
          </a>
          <a href="/coin/bill/{{ handler.user._id }}">
            <button class="primary rounded button">查看我的硬币发放记录</button>
          </a>
          <a href="/coin/show">
            <button class="primary rounded button">查看所有人的硬币余额</button>
          </a>
        </div>

      </div>
      <div class="section__body no-padding">
        <div data-fragment-id="ranking">
          {% if not udocs.length %}
          {{ nothing.render('没人有过硬币！') }}
          {% else %}
          <table class="data-table">
            <colgroup>
		<col class="col--uid" style="width:9rem">
                <col class="col--user">
                <col class="col--coin_all" style="width:12rem">
                <col class="col--coin_now" style="width:12rem">
                <col class="col--op" style="width:9rem">
            </colgroup>
            <thead>
              <tr>
                <th class="col--uid">用户 ID</th>
                <th class="col--user">用户名</th>
                <th class="col--coin_all">累计获取硬币</th>
                <th class="col--coin_now">当前剩余硬币</th>
                <th class="col--op">查看明细</th>
	      </tr>
            </thead>
            <tbody>
              {%- for udoc in udocs -%}
              <tr>
                <td class="col--uid">{{ udoc._id }}</td>
                <td class="col--user">
		  {{ user.render_inline(udoc) }}
                </td>
                <td>{{ udoc.coin_all }}</td>
                <td>{{ udoc.coin_now }}</td>
		<td><a href="/coin/bill/{{ udoc._id }}">查看明细</a></td>
              </tr>
              {%- endfor -%}
            </tbody>
          </table>         
          {{ paginator.render(page, upcount) }}
	  {% endif %}
        </div>
      </div>
    </div>
  </div>
</div>
{% endblock %}
